import static org.junit.Assert.*;

import java.util.ArrayList;

import org.junit.Test;

/**
 * Copyright (C) 2013  Arun Lee & Bryce Nagareda
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * @author briceorbryce
 *
 */
public class SundialSaveTest {
	
	/**
	 * The file, "last run" must have 5 lines in it.<br />
	 * This test method manually puts the values into the class to make sure 
	 * it passes or fails when its suppose to.<br />
	 */
	@SuppressWarnings({ "static-method" })
	@Test
	public void test1() {
		ArrayList<String> results = new ArrayList<String>();
		results.add("8");
		results.add("8");
		results.add("3");
		results.add("January");
		results.add("horizontal");
		SundialSave sds = new SundialSave(results);
		assertTrue(sds.getShowPreviousSundialButton());
	}
	
	/**
	 * The file, "last run" must have 5 lines in it.<br />
	 * This test method manually puts the values into the class to make sure 
	 * it passes or fails when its suppose to.<br />
	 * It fails because latitude is a char.
	 */
	@SuppressWarnings({ "static-method" })
	@Test
	public void test2() {
		ArrayList<String> results = new ArrayList<String>();
		results.add("a");
		results.add("8");
		results.add("3");
		results.add("January");
		results.add("horizontal");
		SundialSave sds = new SundialSave(results);
		assertFalse(sds.getShowPreviousSundialButton());
	}
	
	/**
	 * The file, "last run" must have 5 lines in it.<br />
	 * This test method manually puts the values into the class to make sure 
	 * it passes or fails when its suppose to.<br />
	 * It fails because longitude is a char.
	 */
	@SuppressWarnings({ "static-method" })
	@Test
	public void test3() {
		ArrayList<String> results = new ArrayList<String>();
		results.add("8");
		results.add("a");
		results.add("3");
		results.add("January");
		results.add("horizontal");
		SundialSave sds = new SundialSave(results);
		assertFalse(sds.getShowPreviousSundialButton());
	}
	
	/**
	 * The file, "last run" must have 5 lines in it.<br />
	 * This test method manually puts the values into the class to make sure 
	 * it passes or fails when its suppose to.<br />
	 * It fails because "horizontal" is spelled wrong.
	 */
	@SuppressWarnings({ "static-method" })
	@Test
	public void test4() {
		ArrayList<String> results = new ArrayList<String>();
		results.add("8");
		results.add("8");
		results.add("3");
		results.add("January");
		results.add("horizojntal");
		SundialSave sds = new SundialSave(results);
		assertFalse(sds.getShowPreviousSundialButton());
	}
	
	/**
	 * The file, "last run" must have 5 lines in it.<br />
	 * This test method manually puts the values into the class to make sure 
	 * it passes or fails when its suppose to.<br />
	 */
	@SuppressWarnings({ "static-method" })
	@Test
	public void test5() {
		ArrayList<String> results = new ArrayList<String>();
		results.add("37.85");
		results.add("-110.039");
		results.add("3");
		results.add("January");
		results.add("horizontal");
		SundialSave sds = new SundialSave(results);
		assertTrue(sds.getShowPreviousSundialButton());
	}
	
	/**
	 * The file, "last run" must have 5 lines in it.<br />
	 * This test method manually puts the values into the class to make sure 
	 * it passes or fails when its suppose to.<br />
	 * It fails because the user didn't input a latiude.
	 */
	@SuppressWarnings({ "static-method" })
	@Test
	public void test6() {
		ArrayList<String> results = new ArrayList<String>();
		results.add("");
		results.add("-110.039");
		results.add("3");
		results.add("January");
		results.add("horizontal");
		SundialSave sds = new SundialSave(results);
		assertFalse(sds.getShowPreviousSundialButton());
	}
	/**
	 * 
	 */
	@SuppressWarnings({ "static-method" })
	//@Test
	public void test7() {
		try {
			SundialMath sds = new SundialMath(37.85, -110.039, 3, "January");
			new SundialSave().saveToFile(sds, "January", "horizontal");
		}
		catch (MonthDayException fail) {
			fail("An exception was thrown.");
		}
	}
}
